package de.stefanocke.roo.wicket.base;

import org.springframework.roo.classpath.PhysicalTypeMetadata;
import org.springframework.roo.classpath.details.annotations.populator.AutoPopulate;
import org.springframework.roo.model.JavaType;


/**
 * The annotation values for a custom component (generated or hand-written).
 * The model class is the domain model type the component is for.
 * The required annotations allow to restrict for which bean properties this form component shall be applied.
 * 
 * @author stoc
 *
 */
public class ComponentAnnotationValuesBase extends ModelClassAwareAnnotationValuesBase implements ComponentFilterAttributes {

	@AutoPopulate
	protected JavaType[] requiredAnnotations = new JavaType[0];
	
	protected ComponentAnnotationValuesBase(PhysicalTypeMetadata governorPhysicalTypeMetadata, Class<?> annotationType, boolean subclassWillCallPopulate) {
		super(governorPhysicalTypeMetadata, annotationType, true);
		if (!subclassWillCallPopulate) {
			populate();
		}
	}
	
	/**
	 * 
	 * @return the annotations that must be present at the bean property for this form component to be used
	 */
	public JavaType[] getRequiredAnnotations() {
		return requiredAnnotations;
	}

//	@Override
//	public JavaType[] getAllowedModelClasses() {
//		return new JavaType[]{getModelClass()};  //we (currently) support only one model class per component. 
//	}

}
